import SearchTablePage from '@/components/SearchTablePage';
import { PERMISSION_KEY_TERMINAL_TYPE } from '@/constants';
import {
  addTerminalType,
  deleteTerminalTypeById,
  getTerminalTypeById,
  getTerminalTypeListByPage,
  updateTerminalType,
} from '@/services/terminal/type';

const Brand: React.FC = () => {
  return (
    <>
      <SearchTablePage<API.TerminalType>
        tableName="设备类型"
        getRowById={getTerminalTypeById}
        updateRow={updateTerminalType}
        addRow={addTerminalType}
        deleteRowById={deleteTerminalTypeById}
        getRowsByPage={getTerminalTypeListByPage}
        permissionKey={PERMISSION_KEY_TERMINAL_TYPE}
        rowSelection={false}
        columns={[
          {
            title: '设备类型 ID',
            dataIndex: 'id',
            hideInTable: true,
            hideInSearch: true,
            hideInModal: true,
          },
          {
            title: '类型英文名称',
            dataIndex: 'enName',
            showDetail: true,
            rules: [{ required: true }],
          },
          {
            title: '类型中文名称',
            dataIndex: 'cnName',
            rules: [{ required: true }],
          },
          {
            title: '设备类型图标',
            dataIndex: 'icon',
            hideInSearch: true,
          },
          {
            title: '备注',
            dataIndex: 'remark',
            hideInSearch: true,
          },
          {
            title: '创建时间',
            dataIndex: 'createTime',
            valueType: 'dateTime',
            hideInSearch: true,
            hideInModal: true,
          },
        ]}
      />
    </>
  );
};

export default Brand;
